<!--数据字典管理-->
<template>
  <a-modal v-model="showAddTable" :mask-closable="false" :closable="false" :width="600"
           title="实验进展列表"
           :maskClosable="false"
           :destroyOnClose="true">
    <div style="height: 10px"></div>
      <a-table :columns="columns" :dataSource="labEvolveList" :rowKey="record => record.stage"
               :pagination="false">
                <span slot="index" slot-scope="text, record, index">
                    {{ (page.currentPage - 1) * page.pageSize + index + 1 }}
                </span>
        <span slot="stage" slot-scope="text, record, index">
                    {{ '第'+text+'阶段'}}
                </span>
      </a-table>
  </a-modal>
</template>

<script>
import Page from 'module/pagination'
import Util from '@/libs/util';

export default {
  name: 'labEvolveManage',
  components: {
  },
  data() {
    return {
      title: true,
      showAddTable: false,
      classTId: '',
      labEvolveList: [],
      page: {
        currentPage: 1,
        pageSize: 10
      },
      columns: [
        {title: '序号', key: 'index', width: '8%', align: 'center', scopedSlots: {customRender: 'index'}},
        {title: '阶段', dataIndex: 'stage', key: 'stage', width: '15%', scopedSlots: {customRender: 'stage'}},
        {title: '完成人数', dataIndex: 'stuNum', key: 'stuNum', width: '15%',},
      ],
    }
  },
  computed: {

  },
  filters: {
    filterWord(value, list) {
      for (let i = 0; i < list.length; i++) {
        if (value === list[i].value) {
          return list[i].label
        }
      }
    },
  },
  methods: {

    showModal (obj) {
      this.showAddTable = true
      this.classTId = obj.classTId
      this.init()
    },

    emitEmpty() {
      this.searchKey = ''
      this.init()
    },
    reStore() {
      this.init();
    },

    clearDTO() {
      this.objDTO = {
        recordId: '',
        name: '',
        buildName: '',
        buildCode: '',
        roomCode: '0',
        diskNum: '',
      }
    },
    /*
     * 过滤输入框输入的特殊字符
     * */
    formatEnterContent(value) {
      let a = Util.clearSpecialChart(value);
      this.searchKey = a
    },
    /**
     * Function    : init
     * Description : 初始化列表
     * Input       : none
     * Return      : none
     */
    init() {
      this.selectedRowKeys = []
      let para = Object.assign({},
          {classTId: this.classTId})
      this.$store.dispatch('loadLabEvolveListAct', para).then (response => {
        if (response.code === 0) {
          this.labEvolveList = response.data
          this.$message.success (response.message)
        } else {
          this.$message.error (response.message)
        }
      })
    },



  },
  created() {
    this.searchKey = this.$route.query.searchKey === undefined ? '' : this.$route.query.searchKey
    this.page.currentPage = this.$route.query.currentPage === undefined ? 1 : this.$route.query.currentPage
    this.page.pageSize = this.$route.query.pageSize === undefined ? 10 : this.$route.query.pageSize
    // this.init()
  },
  mounted() {

  }
}
</script>
